package org.example.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.example.pojo.Photo;

import java.util.List;

/**
 * @author LENOVO
 * @description 针对表【Photo(相片表)】的数据库操作Mapper
 * @createDate 2024-04-07 16:34:33
 * @Entity org.example.pojo.Photo
 */
@Mapper
public interface PhotoMapper {

    int deleteByPrimaryKey(Long id);

    int insert(Photo record);

    int insertSelective(Photo record);

    Photo selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Photo record);

    int updateByPrimaryKey(Photo record);

    @Insert("insert into Photo(album_category_id, image_url, add_time, location) values (#{id},#{url},now(),#{location})")
    void addPhoto(String id, String url, String location);

    @Select("select * from Photo where album_category_id=#{id}")
    List<Photo> list(String id);


    @Delete("delete from Photo where id=#{id}")
    void deletePhoto(String id);

    @Delete("delete from Photo where album_category_id=#{id}")
    void deleteCoupleAlbumPhoto(String id);
}
